<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" v-model="num1">
    <input type="text" v-model="num2">
    <input type="button" value="加" @click="f('+')">
    <input type="button" value="减" @click="f('-')">
    <input type="button" value="乘" @click="f('*')">
    <input type="button" value="除" @click="f('/')">
    <div>{{result}}</div>
</div>

<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script>
  let v = new Vue({
    el:"body>div",
    data:{
        num1:"",
        num2:"",
        result:""
    },
    methods:{
      f(x) {
          //eval();此方法可以将字符串以js代码的形式运行
          v.result = eval(v.num1+x+v.num2)
      }
     }
  })
</script>
</body>
</html>